<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>对象属性遍历</title>
  </head>
  <body>
    <p>ES6 遍历对象属性方法</p>
    <ul>
      <li>
        <span> for...in </span>
        <span>遍历对象自有和继承的可枚举属性</span>
      </li>
      <li>
        <span> Object.keys(obj)</span>
        <span> 返回数组，遍历对象自有的可枚举属性</span>
      </li>
      <li>
        <span> Object.getOwnPropertyNames(obj)</span>
        <span>返回数组，遍历自有可以枚举和不枚举的属性</span>
      </li>
      <li>
        <span>Object.getOwnPropertySymbols(obj)</span>
        <span>遍历自身的Symbol</span>
      </li>
      <li>Reflect.ownKeys(obj)</li>
    </ul>

    <p>
      遍历规则：首先遍历属性名为数值的属性，再遍历属性名为字符串的，最后遍历属性名是Symbol的属性
    </p>
  </body>
</html>
